#ifndef __KEYBOARD_LAYER_H__
#define __KEYBOARD_LAYER_H__

#include "cocos2d.h"
#include "define/DataTypeDefine.h"
#include "utility/string/FormatUtil.h"
#include "audio/include/AudioEngine.h"

using namespace cocos2d;
using namespace std;
using namespace experimental;

class KeyboardLayer : public cocos2d::Layer
{
public:
	virtual bool init();

	CREATE_FUNC(KeyboardLayer);

	~KeyboardLayer();

	void tone(bool success);
private:
	void keyReleased(cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event *event);


	void keyCodeHandle(cocos2d::EventKeyboard::KeyCode keyCode);

	void onToneComplete();

	void clearBusy(float dt);

public:
	bool m_listen;
	string m_cardNumber;
	string m_lastCardNumber;
	bool m_selfWait;

private:
	int m_count;
	int m_tipCount;
	bool m_isToning;
	BYTE* m_receiveBuffer;
	bool m_busy;
};

#endif // __KEYBOARD_LAYER_H__